import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { EnvDetailVO, EnvDetailForm, EnvDetailQuery } from '@/api/system/envDetail/types';

/**
 * 查询环境条件列表
 * @param query
 * @returns {*}
 */

export const listEnvDetail = (query?: EnvDetailQuery): AxiosPromise<EnvDetailVO[]> => {
  return request({
    url: '/system/envDetail/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询环境条件详细
 * @param id
 */
export const getEnvDetail = (id: string | number): AxiosPromise<EnvDetailVO> => {
  return request({
    url: '/system/envDetail/' + id,
    method: 'get'
  });
};

/**
 * 新增环境条件
 * @param data
 */
export const addEnvDetail = (data: EnvDetailForm) => {
  return request({
    url: '/system/envDetail',
    method: 'post',
    data: data
  });
};

/**
 * 修改环境条件
 * @param data
 */
export const updateEnvDetail = (data: EnvDetailForm) => {
  return request({
    url: '/system/envDetail',
    method: 'put',
    data: data
  });
};

/**
 * 删除环境条件
 * @param id
 */
export const delEnvDetail = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/envDetail/' + id,
    method: 'delete'
  });
};
